package towerDefense.circlesprites;

import towerDefense.towers.CircleSprite;
import towerDefense.util.TDException;
import com.golden.gamedev.object.Sprite;
import com.golden.gamedev.object.SpriteGroup;


public class CircleSpriteGroup extends SpriteGroup
{

    public CircleSprite[] getCircleSprites ()
    {
        CircleSprite[] cs = new CircleSprite[super.getSprites().length];
        for (int i = 0; i < cs.length; i++)
        {
            cs[i] = (CircleSprite) super.getSprites()[i];
        }
        return cs;
    }


    public CircleSpriteGroup (String name)
    {
        super(name);
    }


    @Override
    public void add (Sprite member)
    {
        if (member instanceof CircleSprite) super.add(member);
        else throw new TDException("Cannot add a non-circleSprite to a circleSprite group");

    }


    @Override
    public void add (int index, Sprite member)
    {
        if (member instanceof CircleSprite) super.add(index, member);
        else throw new TDException("Cannot add a non-circleSprite to a circleSprite group");
    }

}
